<template>
  <div class="gift-card-container">
    <div class="title">使用礼品卡</div>
    <CheckBox class="margin-12">可用余额 ￥0.00</CheckBox>
    <div class="add-gift-card" @click="showAddGiftCardHandler()">添加礼品卡 <span class="iconfont" :class="{ 'icon-xiajiantoushixinxiao': !isAdd, 'icon-shangjiantoushixinxiao': isAdd }"></span></div>
    <div class="input-area" v-if="isAdd">
      <input type="text" placeholder="请输入礼品卡密码">
      <button>绑定</button>
    </div>
  </div>
</template>

<script>
import CheckBox from '@/components/common/CheckBox'

export default {
  data () {
    return {
      isAdd: false
    }
  },

  methods: {
    /**
     * 展示增加礼品卡
     */
    showAddGiftCardHandler () {
      this.isAdd = !this.isAdd
    }
  },

  components: {
    CheckBox
  }
}
</script>

<style lang="less" scoped>
.gift-card-container {
  padding: 5px 20px;
  .title {
    color: #666;
    font-size: 14px;
  }
  .margin-12 {
    margin: 12px 0px;
  }
  .add-gift-card {
    color: #69c;
    cursor: pointer;
    margin-top: 12px;
    .iconfont {
      font-size: 16px;
    }
  }
  .input-area {
    display: flex;
    margin-top: 20px;
    input {
      border: 1px solid #ccc;
      color: #333;
      flex: 1;
      padding: 0px 6px;
      height: 34px;
      outline: 0;
    }
    button {
      background-color: #fff;
      border: 1px solid #ccc;
      border-left: 0px;
      border-radius: 0;
      color: #333;
      cursor: pointer;
      height: 34px;
      width: 58px;
      outline: 0;
    }
  }
}
</style>
